#ifndef PHYSICS_H
#define PHYSICS_H

#include "Cell.h"
#include "MonteCarloIterator.h"
#include "PhysicsParameters.h"

class World;

/* physics */
class Physics {
public:
	/* ctor */
	Physics(World& world);

	/* run */
	void run(int nIterations);
	void runOnce();

	/* parameters */
	PhysicsParameters& getParameters();

private:
	PhysicsParameters  _parameters; /* parameters */
	World&             _world;      /* world      */
	MonteCarloIterator _iterator;   /* iterator   */

	void _updateCells();

	/* update probability */
	double _getAdhesionIdId(CellId id1, CellId id2);
	double _getAdhesionSum(int xPosition, int yPosition, CellId centralId);
	bool   _isUpdateValid(int xPosition, int yPosition);
	double _getUpdateProbability(int xPosition, int yPosition, CellId cellId);
};

//	int doGetBorderCount(int xPosition, int yPosition, CellId centralId);
//	int doGetSameNeighbourCount(int xPosition, int yPosition, CellId centralId);

#endif	// PHYSICS_H

